package nl.windgazer.arachne.services.messages;

import org.apache.tapestry5.Binding;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.internal.bindings.MessageBindingFactory;
import org.apache.tapestry5.ioc.Location;
import org.apache.tapestry5.ioc.ScopeConstants;
import org.apache.tapestry5.ioc.annotations.Scope;
import org.apache.tapestry5.services.BindingFactory;
import org.apache.tapestry5.services.BindingSource;
import org.apache.tapestry5.services.Environment;

@Scope(ScopeConstants.PERTHREAD)
public class MessageBindingFactoryInterceptor extends MessageBindingFactory implements BindingFactory {

	private Environment environment;

	public MessageBindingFactoryInterceptor(BindingSource bs, Environment environment) {
		super();
		this.environment = environment;
	}

	public Binding newBinding(String description, ComponentResources container, ComponentResources component, String expression, Location location) {
		return new MessageBindingInterceptor(super.newBinding(description, container, component, expression, location), environment, expression, container.getLocale());
	}

}
